package com.copm.ifm.base.service.redis.stream;

import com.copm.ifm.base.basic.pojo.SysExceptionLog;
import com.copm.ifm.common.redis.RedisUtil;

/**
 * redis stream流消息帮助类
 *
 * @author zzf
 * @date 2021/3/16 9:23
 */
public class RedisStreamProducer {

    /**
     * 发送异常日志消息
     *
     * @param exceptionLog 异常消息内容
     */
    public static void sendExceptionLogMsg(SysExceptionLog exceptionLog) {
        RedisUtil.getInstance().sendStreamSmg(getExceptionLogKey(), exceptionLog);
    }

    public static String getExceptionLogGroup() {
        return GroupDefine.EXCEPTION_LOG;
    }

    public static String getExceptionLogKey() {
        return KeyDefine.EXCEPTION_LOG;
    }


    /**
     * 键值定义
     */
    private interface KeyDefine {

        /**
         * 异常日志
         */
        String EXCEPTION_LOG = "stream:exception_log";

    }

    /**
     * 消息组定义
     */
    private interface GroupDefine {

        /**
         * 异常日志
         */
        String EXCEPTION_LOG = "group_exception";
    }

}
